<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('特殊拨款列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li class="select-time">
                                <label>支付日期：</label>
                                <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginZfrq]"/>
                                <span>-</span>
                                <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endZfrq]"/>
                            </li>
                            <li>
								付款银行：<select name="jkrzh" >
									<option value="">所有银行</option>
									<option th:each="bk : ${yhlist}" th:text="${bk.yhmc}" th:value="${bk.skrzh}"></option>
								</select>
							</li>
                            <li >
								<label>状态： </label><select name="shbz">
								    <option value="0">未审核</option> 
									<option value="1">已审核</option>
								    <option value="">全部</option>
								</select>
							</li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:zfpzto:add">
                    <i class="fa fa-plus"></i> 添加
                </a>
                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:zfpzto:edit">
                    <i class="fa fa-edit"></i> 修改
                </a>
                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:zfpzto:remove">
                    <i class="fa fa-remove"></i> 删除
                </a>
                <a class="btn btn-success multiple disabled" onclick="verify()" shiro:hasPermission="system:zfpzto:verify">
                    <i class="fa fa-remove"></i> 审核
                </a>
                <a class="btn btn-success multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:zfpzto:remove">
                    <i class="fa fa-remove"></i> 打印
                </a>
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:zfpzto:export">
                    <i class="fa fa-download"></i> 导出
                </a>
            </div>
            <div class="col-sm-12 select-table">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('system:zfpzto:edit')}]];
        var removeFlag = [[${@permission.hasPermi('system:zfpzto:remove')}]];
        var prefix = ctx + "system/zfpzto";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "特殊拨款",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'zfxh',
                    title: '国库支付序号',
                    visible: false
                },
                {
                    field: 'zfrq',
                    title: '支付日期'
                },
                {
                    field: 'skrmc',
                    title: '收款人名称'
                },
                {
                    field: 'skrzh',
                    title: '收款人账号'
                },
                {
                    field: 'skryh',
                    title: '收款人银行'
                },
                {
                    field: 'jkrmc',
                    title: '付款人名称'
                },
                {
                    field: 'jkrzh',
                    title: '付款人帐号'
                },
                {
                    field: 'jkryh',
                    title: '付款人银行'
                },
                {
                    field: 'sh',
                    title: '审核人'
                }, 
                {
                    field: 'zd',
                    title: '制单人'
                },
                {
                    field: 'shbz',
                    title: '审核标志',
                    formatter: function(value, row, index) {
                    	return shbz(row); 
                    }
                },
                {
                    field: 'zje',
                    title: '总金额'
                },
                {
                    field: 'dybz',
                    title: '打印标志 ',
                    formatter: function(value, row, index) {
                    	return dybz(row); 
                    }
                },
                {
                    field: 'bkyt',
                    title: '拨款用途'
                },
                {
                    field: 'bklx',
                    title: '拨款类型',
                    formatter: function(value, row, index) {
                    	return bklx(row); 
                    }
                },
                {
                    field: 'kjkmdm',
                    title: '会计科目代码 '
                },
                {
                    field: 'kjkmmc',
                    title: '会计科目名称 '
                },
                {
                    field: 'gnkmdm',
                    title: '功能科目代码'
                },
                {
                    field: 'gnkmmc',
                    title: '功能科目名称'
                },
                {
                    field: 'jjkmdm',
                    title: '经济科目代码'
                },
                {
                    field: 'jjkmmc',
                    title: '经济科目名称'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        if (row.shbz ==0) {
	                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.zfxh + '\')"><i class="fa fa-edit"></i>编辑</a> ');
	                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.zfxh + '\')"><i class="fa fa-remove"></i>删除</a>');
                        }else{
                        	actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="cancel(\'' + row.pztxh + '\',\''+ row.zfxh + '\')"><i class="fa fa-remove"></i>撤销审核</a>');
                        	actions.push('<a class="btn btn-success btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="pzlist(\'' + row.pztxh + '\')"><i class="fa fa-search"></i>查看凭证</a>');
                        }
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });
        /* 用户状态显示 */
		function bklx(row) {
		    if (row.bklx == 0) {
    			return '经济科目拨款';
    		} else {
    			return '会计科目拨款';
    		}
		}
		 /* 用户状态显示 */
		function dybz(row) {
		    if (row.dybz == 0) {
    			return '未打印';
    		} else {
    			return '已打印';
    		}
		}
		function shbz(row) {
		    if (row.shbz == 0) {
    			return '未审核';
    		} else {
    			return '已审核';
    		}
		}
        function pzlist(pztxh) {
		    var url = ctx + 'system/pzto/pzlist/' + pztxh;
		    $.modal.openFull("查看凭证", url, '800', '540');
		}
        
        function verify(){
	        var rows =$.table.selectColumns("zfxh");
			if (rows.length == 0) {
				$.modal.alertWarning("请至少选择一条记录");
				return;
			}
			$.modal.confirm("确认要审核选中的" + rows.length + "条数据吗?", function() {
				var url=prefix + "/verify";
				var data = { "ids": rows.join() };
				$.operate.submit(url, "post", "json", data);
			});
        }
        function cancel(pztxh,zfxh){ 
			$.modal.confirm("确认要撤销此条记录吗?", function() {
				var url=prefix + "/cancel";
				var data = { "pztxh": pztxh, "zfxh": zfxh};
				$.operate.submit(url, "post", "json", data);
			});
        }
    </script>
</body>
</html>